<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    html{
      height: 100%;
      background-color: #fff;
      color: #000;
      font-size: 62.5%;
    }
    body{
      min-height: 100%;
      margin: 0;
      font-size: 1.4rem;
      display: grid;
      place-items: center;
    }
    .button{
      background-color: #42B983;
      color: #fff;
      border: none;
      outline: none;
      font-size: 1.8rem;
      padding: 0.5em 1em;
      border-radius: .3em;
      cursor: pointer;
    }
    .modal{
      position: fixed;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      margin: auto;
      transform: none;
      text-align: center;
      width: fit-content;
      height: fit-content;
      max-width: 22em;
      background-color: #fff;
      padding: 2rem;
      border-radius: 1rem;
      box-shadow: 0 5px 5px rgba(0, 0, 0, 0.2);
      z-index: 999;
    }
    .modal h1, .modal p{
      margin: 0 0 1rem;
    }
    .modal-overlay{
      position: fixed;
      top: 0;
      bottom: 0;
      right: 0;
      left: 0;
      z-index: 998;
      background-color: #2c3e50;
      opacity: 0.6;
    }

    .pop-enter-active,
    .pop-leave-active{
      transition: transform .4s cubic-bezier(0.5, 0, 0.5, 1), opacity .4s linear;
    }
    .pop-enter,
    .pop-leave-to{
      transform: scale(0.3) translateY(-50%);
      opacity: 0;
    }
    .fade-enter-active,
    .fade-leave-active{
      transition: opacity .4s linear;
    }
    .fade-enter,
    .fade-leave-to{
      opacity: 0;
    }
  </style>
</head>
<body>
  <div id="app">
    <button class="button" @click="showModal = true">Show Modal</button>
    <transition name = 'fade'>
      <div class="modal-overlay" v-if="showModal"></div>
    </transition>
    <transition name = "pop">
      <div class="modal" v-if="showModal">
        <h1>Vue Transitions</h1>
        <p>The <code>&lt;transition&gt;</code> component in Vue can create wonderful animated entrances and exits.</p>
        <button class="button" @click="showModal = false">Hide Modal</button>
      </div>
    </transition>
  </div>

  <script>
    new Vue({
      el: '#app',
      data () {
        return {
          showModal: false
        }
      }
    })
  </script>
</body>
</html>
